//
//  XBZuiXinController.m
//  Home
//
//  Created by 陈明茂 on 16/3/29.
//  Copyright © 2016年 iOS. All rights reserved.
//

#import "XBZuiXinController.h"


@interface XBZuiXinController ()

@end

@implementation XBZuiXinController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableView.backgroundColor = [UIColor colorWithWhite:237/255.0 alpha:1];

}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return 8;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    NSString *cellType = [self cellTypeWithIndexPath:indexPath];
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellType forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}


// 判断cell的类型
- (NSString *)cellTypeWithIndexPath:(NSIndexPath *)indexPath{
    
    NSString *cellType = nil;
    switch (indexPath.row) {
        case 0:
            cellType = @"jingxuan_one";
            break;
        case 1:
            cellType = @"jingxuan_two";
            break;
        case 2:
            cellType = @"jingxuan_three";
            break;
        case 3:
            cellType = @"jingxuan_six";
            break;
        case 4:
            cellType = @"jingxuan_four";
            break;
        case 5:
            cellType = @"jingxuan_four";
            break;
        case 6:
            cellType = @"jingxuan_four";
            break;
        case 7:
            cellType = @"jingxuan_five";
            break;
            
        default:
            break;
    }
    
    
    return cellType;
}


// 确认cell的高度
- (CGFloat )cellHeightWithIndexPath:(NSIndexPath *)indexPath{
    
    
    CGFloat cellHeight = 0;
    
    switch (indexPath.row) {
        case 0:
            cellHeight = 120;
            break;
        case 1:
            cellHeight = 200;
            break;
        case 2:
            cellHeight = 160;
            break;
        case 3:
            cellHeight = 44;
            break;
        case 4:
            cellHeight = 100;
            break;
        case 5:
            cellHeight = 100;
            break;
        case 6:
            cellHeight = 100;
            break;
        case 7:
            cellHeight = 2450;
            break;
            
        default:
            break;
    }
    
    return cellHeight;
}

#pragma mark - 确认高度

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return 10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    CGFloat cellHeight = [self cellHeightWithIndexPath:indexPath];

    return cellHeight;
}

@end
